<template>
	<el-col :span="options.span || 22" v-if="showButton(options)">
		<div style="margin-bottom:18px;padding:0 18px;">
			<el-button  :type="options.style || 'primary'" @click="Fn(options.method)" :size="options.size || 'mini'"
				:round="options.round" :plain="options.plain" :circle="options.circle" :icon="options.icon">
				{{options.label}}{{options.showNum?vm.showNumForSave:''}}</el-button>
		</div>
	</el-col>
</template>

<script>
	export default {
		props: {
			value: String,
			options: {
				type: Object,
				default () {
					return {};
				},
			},
		},
    inject: ["vm"],
    computed:{
      perm(){
        if(this.options.perm && this.options.perm.length>0){
          return this.options.perm;
        }
        return ['*'];
      }
    },
		methods: {
			// 方法调用
			Fn(method, row) {
				try {
					this.vm[method](row);
				} catch (e) {
					this.openMessage(`未定义方法 ${method}`, "warning");
				}
			},
			showButton(b, arg) {
				if (b.show) return b.show(this.vm);
				return true;
			},
		},
	};
</script>

<style>
</style>